home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / despereaux-swings.swf / scripts / swings / GameOverScript.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.6 KB  |  81 lines

  1. package swings
  2. {
  3.    import flash.display.*;
  4.    import flash.events.*;
  5.    import flash.net.*;
  6.    import flash.utils.Timer;
  7.    
  8.    public class GameOverScript extends MovieClip
  9.    {
  10.        
  11.       
  12.       public var scorer:MovieClip;
  13.       
  14.       public var playAgainBut:SimpleButton;
  15.       
  16.       public var sharer:MovieClip;
  17.       
  18.       public var logo:MainLogo;
  19.       
  20.       public function GameOverScript()
  21.       {
  22.          var _loc1_:* = undefined;
  23.          super();
  24.          scorer.score.text = String(SwingsGame(parent).score);
  25.          if(SwingsGame(parent).pastDate)
  26.          {
  27.             logo.gotoAndStop(2);
  28.          }
  29.          else
  30.          {
  31.             logo.gotoAndStop(1);
  32.          }
  33.          SwingsGame(parent).playAudio("miceTry");
  34.          _loc1_ = new Timer(2000,1);
  35.          _loc1_.addEventListener("timer",playLoop);
  36.          _loc1_.start();
  37.          playAgainBut.addEventListener(MouseEvent.MOUSE_DOWN,startGame);
  38.          sharer.shareBtn.addEventListener(MouseEvent.MOUSE_DOWN,gotoShare);
  39.          sharer.helpBtn.addEventListener(MouseEvent.MOUSE_DOWN,gotoHelp);
  40.          SwingsGame(parent).returnTo = "gameover";
  41.          SwingsGame(parent).tries = 3;
  42.          SwingsGame(parent).level = 1;
  43.       }
  44.       
  45.       private function gotoShare(param1:MouseEvent) : *
  46.       {
  47.          SwingsGame(parent).score = 0;
  48.          sharer.shareBtn.removeEventListener(MouseEvent.MOUSE_DOWN,gotoShare);
  49.          sharer.helpBtn.removeEventListener(MouseEvent.MOUSE_DOWN,gotoHelp);
  50.          playAgainBut.removeEventListener(MouseEvent.MOUSE_DOWN,startGame);
  51.          SwingsGame(parent).fade("share");
  52.       }
  53.       
  54.       private function gotoHelp(param1:MouseEvent) : *
  55.       {
  56.          SwingsGame(parent).score = 0;
  57.          sharer.shareBtn.removeEventListener(MouseEvent.MOUSE_DOWN,gotoShare);
  58.          sharer.helpBtn.removeEventListener(MouseEvent.MOUSE_DOWN,gotoHelp);
  59.          playAgainBut.removeEventListener(MouseEvent.MOUSE_DOWN,startGame);
  60.          SwingsGame(parent).fade("help1");
  61.       }
  62.       
  63.       public function startGame(param1:MouseEvent) : *
  64.       {
  65.          SwingsGame(parent).score = 0;
  66.          playAgainBut.removeEventListener(MouseEvent.MOUSE_DOWN,startGame);
  67.          sharer.shareBtn.removeEventListener(MouseEvent.MOUSE_DOWN,gotoShare);
  68.          sharer.helpBtn.removeEventListener(MouseEvent.MOUSE_DOWN,gotoHelp);
  69.          SwingsGame(parent).fade("game");
  70.       }
  71.       
  72.       public function playLoop(param1:TimerEvent) : *
  73.       {
  74.          if(SwingsGame(parent).playMusic)
  75.          {
  76.             SwingsGame(parent).playAudio("idleLoop",100,0,0,0.2);
  77.          }
  78.       }
  79.    }
  80. }
  81.